<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>支持向量机（上） | Bulua</title><meta name="keywords" content="svm, 支持向量机"><meta name="author" content="Bulua"><meta name="copyright" content="Bulua"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="SVM支持向量机，号称机器学习的拦路虎。江湖传言，遇到了他，机器学习就会从入门到放弃。另一方面也就是说，只要搞定了SVM，后面的算法模型学起来都是小意思。">
<meta property="og:type" content="article">
<meta property="og:title" content="支持向量机（上）">
<meta property="og:url" content="http://bulua.gitee.io/2021/10/12/svm-shang/index.html">
<meta property="og:site_name" content="Bulua">
<meta property="og:description" content="SVM支持向量机，号称机器学习的拦路虎。江湖传言，遇到了他，机器学习就会从入门到放弃。另一方面也就是说，只要搞定了SVM，后面的算法模型学起来都是小意思。">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://gitee.com/bulua/bulua_img/raw/master/download.jpg">
<meta property="article:published_time" content="2021-10-12T00:30:53.000Z">
<meta property="article:modified_time" content="2021-10-12T07:47:24.502Z">
<meta property="article:author" content="Bulua">
<meta property="article:tag" content="机器学习">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/bulua/bulua_img/raw/master/download.jpg"><link rel="shortcut icon" href="https://gitee.com/bulua/bulua_img/raw/master/tubiao.jpg"><link rel="canonical" href="http://bulua.gitee.io/2021/10/12/svm-shang/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: 'days',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"Traditional Chinese Activated Manually","cht_to_chs":"Simplified Chinese Activated Manually","day_to_night":"Dark Mode Activated Manually","night_to_day":"Light Mode Activated Manually","bgLight":"#49b1f5","bgDark":"#121212","position":"top-center"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '支持向量机（上）',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-10-12 15:47:24'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    document.addEventListener('pjax:complete', detectApple)})(window)</script><link rel="stylesheet" href="/css/custom.css" media="defer" onload="this.media='all'"><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/tubiao.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">8</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">3</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gitee.com/bulua/bulua_img/raw/master/download.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Bulua</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">支持向量机（上）</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-10-12T00:30:53.000Z" title="Created 2021-10-12 08:30:53">2021-10-12</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2021-10-12T07:47:24.502Z" title="Updated 2021-10-12 15:47:24">2021-10-12</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="支持向量机（上）"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p>SVM支持向量机，号称<strong>机器学习的拦路虎</strong>。江湖传言，遇到了他，机器学习就会从入门到放弃。另一方面也就是说，只要搞定了SVM，后面的算法模型学起来都是小意思。</p>
<span id="more"></span>

<h2 id="1-什么是SVM"><a href="#1-什么是SVM" class="headerlink" title="1.什么是SVM"></a>1.什么是SVM</h2><p>由于SVM较复杂，我分两篇来进行阐述，本篇仅介绍SVM的基本概念。</p>
<p>先看下官方定义：</p>
<blockquote>
<p>支持向量机方法是建立在统计学习理论的VC 维理论和结构风险最小原理基础上的，根据有限的样本信息在模型的复杂性和学习能力之间寻求最佳折衷，以期获得最好的泛化能力。</p>
</blockquote>
<p>VC 维，结构风险，有限样本，模型复杂性，最佳折衷，泛化能力，这一切……真是让人摸不着头脑……</p>
<p>行了，文绉绉的理论从来看不懂，我们还是从算法看起吧。</p>
<p>SVM一般用于<strong>解决二分类问题</strong>（也可以解决多分类和回归问题，本文暂不涉及），数学化语言概述如下：</p>
<p><strong>样本数据</strong>：n个样本，p个输入 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=(x_%7B1%7D,...,x_%7Bp%7D)" alt="[公式]"> ，1个输出y</p>
<p><strong>第i个样本的输入</strong>： <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=X_%7Bi%7D=(x_%7Bi1%7D,x_%7Bi2%7D,...,x_%7Bip%7D)%5E%7BT%7D,+i=1,2,...n" alt="[公式]"></p>
<p><strong>输出y</strong>：一般用1和-1作为两类样本的标签</p>
<p><strong>训练样本集D</strong>：</p>
<p><img src= "" data-lazy-src="https://pic2.zhimg.com/80/v2-9eef41d8a956320535f1ba2b9e51b789_720w.jpg" alt="img"></p>
<p><strong>训练目的</strong>：以训练样本为研究对象，在样本的特征空间中找到一个超平面 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W%5E%7BT%7DX+b=0" alt="[公式]">，将两类样本（＋1和－1）有效分开，其中 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W=(w_%7B1%7D,w_%7B2%7D,...,w_%7Bp%7D)%5E%7BT%7D" alt="[公式]"></p>
<p>然而，这些个公式……更是看的云里雾里……</p>
<p>没关系，抽象的数学语言难以理解，我们就从直观的图形和例子开始，抽丝剥茧一点点学。</p>
<h2 id="2-线性分类器的含义"><a href="#2-线性分类器的含义" class="headerlink" title="2.线性分类器的含义"></a>2.线性分类器的含义</h2><p>上一篇学线性回归时，是从一元线性回归讲起。一元，即一个自变量，再加上一个因变量，这种数据形式在二维坐标轴中就可以表示成(x,y)。(x,y)的数据形式可以通过画点、画线在二维平面上进行展示，方便初学者理解。</p>
<p>学习算法时通过图的形式来入门，最合适不过。那么，我们讲SVM也从平面上的点和线讲起不就好了。</p>
<p>我们用图看看线性分类器要解决什么样的问题。</p>
<p><img src= "" data-lazy-src="https://pic4.zhimg.com/80/v2-47556c105a2f48d41c317b4559370c6b_720w.jpg" alt="img"></p>
<p>假设有两类要区分的样本点，一类用黄色圆点代表，另一类用红色方形代表，中间这条直线就是一条能将两类样本完全分开的分类函数。</p>
<p>用前面的数学化语言描述一下这个图，就是：</p>
<p><strong>样本数据</strong>：11个样本，2个输入 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=(x_%7B1%7D,x_%7B2%7D)" alt="[公式]"> ，一个输出y</p>
<p><strong>第i个样本的输入</strong>： <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=X_%7Bi%7D=(x_%7Bi1%7D,x_%7Bi2%7D)%5E%7BT%7D,+i=1,2,...11" alt="[公式]"></p>
<p><strong>输出y</strong>：用1（红色方形）和-1（黄色圆点）作为标签</p>
<p><strong>训练样本集D</strong>：</p>
<p><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/1634024759(1).png"></p>
<p><strong>训练目的</strong>：以训练样本为研究对象，找到一条直线 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=w_%7B1%7Dx_%7B1%7D+w_%7B2%7Dx_%7B2%7D+b=0" alt="[公式]">，将两类样本有效分开。</p>
<p>这里我们引出线性可分的定义：<strong>如果一个线性函数能够将样本分开，就称这些样本是线性可分的</strong>。线性函数在一维空间里，就是一个小小的点；在二维可视化图像中，是一条直直的线；在三维空间中，是一个平平的面；在更高维的空间中，是无法直观用图形展示的超平面。</p>
<p>回想一下线性回归，在一元线性回归中我们要找拟合一条直线，使得样本点（x，y）都落在直线附近；在二元线性回归中，要拟合一个平面，使得样本点（x1，x2，y）都落在该平面附近；在更高维的情况下，就是拟合超平面。</p>
<p>那么，线性分类（此处仅指二分类）呢？当样本点为（x，y）时（注意，和回归不同，由于y是分类标签，y的数字表示是只有属性含义，是没有真正的数值意义的，因此当只有一个自变量时，不是二维问题而是一维问题），要找到一个点wx+b=0，即x=-b/w这个点，使得该点左边的是一类，右边的是另一类。</p>
<p>当样本点为（x1,x2, y）时，要找到一条直线 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=w_%7B1%7Dx_%7B1%7D+w_%7B2%7Dx_%7B2%7D+b=0" alt="[公式]"> ，将平面划分成两块，使得 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=w_%7B1%7Dx_%7B1%7D+w_%7B2%7Dx_%7B2%7D+b%3E0" alt="[公式]"> 的区域是y=1类的点， <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=w_%7B1%7Dx_%7B1%7D+w_%7B2%7Dx_%7B2%7D+b%3C0" alt="[公式]"> 的区域是y=-1类别的点。</p>
<p>更高维度以此类推，由于更高维度的的超平面要写成 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=w_%7B1%7Dx_%7B1%7D+w_%7B2%7Dx_%7B2%7D+...+w_%7Bp%7Dx_%7Bp%7D+b=0" alt="[公式]"> ，会有点麻烦，一般会用矩阵表达式代替，即上面的 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W%5E%7BT%7DX+b=0" alt="[公式]"> 。</p>
<p><img src= "" data-lazy-src="https://pic1.zhimg.com/80/v2-5d27469c857a45ec91066662528bfc04_720w.jpg" alt="img"></p>
<p><img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W%5E%7BT%7DX+b=0" alt="[公式]"> 这个式子中，X不是二维坐标系中的横轴，而是样本的向量表示。例如上面举的二维平面中的例子，假设绿色框内是的坐标是(3,1)，则 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=X%5E%7BT%7D=(x_%7B1%7D,x_%7B2%7D)=(3,1)" alt="[公式]"> 。一般说向量都默认是列向量，因此以行向量形式来表示时，就加上转置。因此， <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W%5E%7BT%7DX+b=0" alt="[公式]"> 中 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W%5E%7BT%7D" alt="[公式]"> 是一组行向量，是未知参数，X是一组列向量，是已知的样本数据，可以将 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=w_%7Bi%7D" alt="[公式]"> 理解为 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=x_%7Bi%7D" alt="[公式]"> 的系数，行向量与列向量相乘得到一个1*1的矩阵，也就是一个实数。</p>
<h2 id="3-怎么找线性分类器"><a href="#3-怎么找线性分类器" class="headerlink" title="3.怎么找线性分类器"></a>3.怎么找线性分类器</h2><p>我们还是先看只有两个自变量的情况下，怎么求解最佳的线性分割。</p>
<p><img src= "" data-lazy-src="https://pic1.zhimg.com/80/v2-168e893dd38f0f8a5d572841892dd4fc_720w.jpg" alt="img"></p>
<p>如图，理想状态下，平面中的两类点是完全线性可分的。这时问题来了，这样能把两类点分割的线有很多啊，哪条是最好的呢？</p>
<p>支持向量机中，对最好分类器的定义是：<strong>最大边界超平面，即距两个类别的边界观测点最远的超平面</strong>。在二维情况下，就是找最宽的马路，在三维问题中，就是找最厚的木板。</p>
<p><img src= "" data-lazy-src="https://pic3.zhimg.com/80/v2-11d87ee4b5f0b6ffeab4fb41c7ddefae_720w.jpg" alt="img"></p>
<p>显然，上图中左边的马路比右边的宽，马路的边界由1、2、3这三个点确定，而马路中间那条虚线，就是我们要的 <img src= "" data-lazy-src="https://www.zhihu.com/equation?tex=W%5E%7BT%7DX+b=0" alt="[公式]"> 。</p>
<p>可以看到，我们找马路时，只会考虑+1类中，离-1类近的点，还有-1类中，离+1类距离近的点，即图中的1、2、3和a、b、c这些点。其他距离对方远的样本点，我们做支持向量机这个模型时，是不考虑的。</p>
<p><strong>由于最大边界超平面仅取决于两类别的边界点，这些点被称为支持向量，因此这种算法被命名为支持向量机</strong>。这个定义就比较好理解了吧？</p>
<p>未完待续……</p>
<p>转载链接：<a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/73477179">https://zhuanlan.zhihu.com/p/73477179</a></p>
<p>原创博主：化简可得</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="mailto:undefined">Bulua</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="http://bulua.gitee.io/2021/10/12/svm-shang/">http://bulua.gitee.io/2021/10/12/svm-shang/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2021/10/12/svm-xia/"><img class="prev-cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">支持向量机（下）</div></div></a></div><div class="next-post pull-right"><a href="/2021/10/11/Logistic-Regression/"><img class="next-cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">Logistic-Regression</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> Related Articles</span></div><div class="relatedPosts-list"><div><a href="/2021/10/19/Kernel-Function/" title="核函数"><img class="cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-10-19</div><div class="title">核函数</div></div></a></div><div><a href="/2021/10/11/Logistic-Regression/" title="Logistic-Regression"><img class="cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-10-11</div><div class="title">Logistic-Regression</div></div></a></div><div><a href="/2021/11/15/PCA/" title="PCA"><img class="cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-11-15</div><div class="title">PCA</div></div></a></div><div><a href="/2021/11/15/LDA/" title="LDA"><img class="cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-11-15</div><div class="title">LDA</div></div></a></div><div><a href="/2021/10/12/svm-xia/" title="支持向量机（下）"><img class="cover" src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-10-12</div><div class="title">支持向量机（下）</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> Comment</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/tubiao.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Bulua</div><div class="author-info__description">No matter how far you may fly, never forget where you come from.</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">8</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">3</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/Bulua" target="_blank" title="Github"><i class="fab fa-github"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>Announcement</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E4%BB%80%E4%B9%88%E6%98%AFSVM"><span class="toc-number">1.</span> <span class="toc-text">1.什么是SVM</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E7%BA%BF%E6%80%A7%E5%88%86%E7%B1%BB%E5%99%A8%E7%9A%84%E5%90%AB%E4%B9%89"><span class="toc-number">2.</span> <span class="toc-text">2.线性分类器的含义</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E6%80%8E%E4%B9%88%E6%89%BE%E7%BA%BF%E6%80%A7%E5%88%86%E7%B1%BB%E5%99%A8"><span class="toc-number">3.</span> <span class="toc-text">3.怎么找线性分类器</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/11/15/LDA/" title="LDA"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="LDA"/></a><div class="content"><a class="title" href="/2021/11/15/LDA/" title="LDA">LDA</a><time datetime="2021-11-15T12:54:12.000Z" title="Created 2021-11-15 20:54:12">2021-11-15</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/11/15/PCA/" title="PCA"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="PCA"/></a><div class="content"><a class="title" href="/2021/11/15/PCA/" title="PCA">PCA</a><time datetime="2021-11-15T12:34:48.000Z" title="Created 2021-11-15 20:34:48">2021-11-15</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/10/19/Kernel-Function/" title="核函数"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="核函数"/></a><div class="content"><a class="title" href="/2021/10/19/Kernel-Function/" title="核函数">核函数</a><time datetime="2021-10-19T11:13:40.000Z" title="Created 2021-10-19 19:13:40">2021-10-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/10/12/svm-xia/" title="支持向量机（下）"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="支持向量机（下）"/></a><div class="content"><a class="title" href="/2021/10/12/svm-xia/" title="支持向量机（下）">支持向量机（下）</a><time datetime="2021-10-12T00:31:00.000Z" title="Created 2021-10-12 08:31:00">2021-10-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/10/12/svm-shang/" title="支持向量机（上）"><img src= "" data-lazy-src="https://gitee.com/bulua/bulua_img/raw/master/download.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="支持向量机（上）"/></a><div class="content"><a class="title" href="/2021/10/12/svm-shang/" title="支持向量机（上）">支持向量机（上）</a><time datetime="2021-10-12T00:30:53.000Z" title="Created 2021-10-12 08:30:53">2021-10-12</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2021  <i id="heartbeat" class="fa fas fa-heartbeat"></i> Bulua</div></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HCLonely/images@master/others/heartbeat.min.css"></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="Switch Between Traditional Chinese And Simplified Chinese">繁</button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="Scroll To Comments"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'K7ke6VBNMaIjRIWWht9uCbsT-gzGzoHsz',
      appKey: 'rl09GFl8gOiYw6OxIIIuOzur',
      placeholder: 'Please leave your footprints',
      avatar: 'monsterid',
      meta: 'nick,mail,link'.split(','),
      pageSize: '10',
      lang: 'en',
      recordIP: false,
      serverURLs: '',
      emojiCDN: '',
      emojiMaps: "",
      enableQQ: true,
      path: window.location.pathname,
      requiredFields: ["nick,mail"],
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !true) {
  if (true) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><div class="aplayer no-destroy" data-id="186016" data-server="netease" data-type="song" data-fixed="true" data-mini="true" data-listFolded="false" data-order="random" data-preload="none" data-autoplay=true muted></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="true" data-click="true"></script><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config-diff',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.removeEventListener('scroll', window.tocScrollFn)
  window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>